import { CHANGE_AGE, CHANGE_NAME } from "./constants"

const initState = {
  name: "Kobe",
  age: 1
}
export default function reducer(state = initState, action) {
  switch (action.type) {
    case CHANGE_NAME:
      return { ...state, name: action.name }
    case CHANGE_AGE:
      return { ...state, age: action.age + state.age }
    default:
      return state
  }
}
